package com.xiaoge.basedevlibrary.imageload;

import android.widget.ImageView;

import org.xutils.image.ImageOptions;
import org.xutils.x;

public class ImageUtils {
    private volatile static ImageUtils instance;

    /**
     * Double Check 单例模式
     *
     * @return
     */
    public static ImageUtils getInstance() {
        if (instance == null) {
            synchronized (ImageUtils.class) {
                if (instance == null) {
                    instance = new ImageUtils();
                }
            }
        }
        return instance;
    }

    public static void load(ImageView imageView, String url) {
        ImageOptions options = new ImageOptions.Builder().setAutoRotate(true)
                .setRadius(20)
                .setFadeIn(true)
                .setAutoRotate(true)
                .setImageScaleType(ImageView.ScaleType.CENTER_CROP)
                .setUseMemCache(true).build();
        x.image().bind(imageView, url, options);
        //x.image().clearCacheFiles();//清楚图片缓存,

    }
}